﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

public class AccesoBD
{
    String rutaBD = "Data Source=localhost;Initial Catalog=ServicioCorreo;Integrated Security=True";

    public SqlConnection ObtenerConexion()
    {
        SqlConnection cn = new SqlConnection(rutaBD);
        try
        {
            cn.Open();
            return cn;
        }
        catch (Exception)
        {
            return null;
        }
    }

    public SqlDataAdapter ObtenerAdaptador(String consultaSQL)
    {
        SqlDataAdapter adaptador;
        try
        {
            adaptador = new SqlDataAdapter(consultaSQL, rutaBD);
            return adaptador;
        }
        catch (Exception)
        {
            return null;
        }
    }

}


